#include <stdio.h>
#include <stdlib.h>
#include <time.h>

/* 函数的嵌套 */
int max4(int a,int b,int c,int d)
{
    int m;
    m = max2(a,b);
    m = max2(m,c);
    m = max2(m,d);
    return m;
}

int max2(int a,int b)
{
    return (a > b? a:b);
}

int main()
{
    srand((unsigned)time(NULL));

    int a,b,c,d,max;
    a = rand() % 100;
    b = rand() % 100;
    c = rand() % 100;
    d = rand() % 100;
    printf("生成的4个随机数为:%5d%5d%5d%5d\n",a,b,c,d); 
    max = max4(a,b,c,d);
    printf("4个随机数里面最大的是%5d\n",max);

    
    return 0;
}